package com.appspot.etao.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.appspot.etao.model.UserModel;
import com.appspot.etao.service.ServiceFactory;
import com.appspot.etao.service.UserService;

public class UserServlet extends BaseServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		
		UserService service = ServiceFactory.getUserService();
		List<UserModel> userList = service.getUserList();
		
		request.setAttribute("userList", userList);

		getServletContext().getRequestDispatcher("/jsp/userList.jsp").forward(request, response);
		
	}
}
